<!-- 内容主体区域 -->
<link rel="stylesheet" href="layui/css/layui.css">
<script type="application/javascript" src="public/jquery.min.js"></script>
<div style="padding: 15px;">
    <div class="layui-tab">
        <div class="layui-tab-content">

            <table class="layui-hide" id="test" lay-filter="test"></table>
            <script type="text/html" id="toolbarDemo">
            </script>
            <script type="text/html" id="show-img">
                // <img src="<?php echo $globals_imgurl; ?>{{d.goods_picture}}" alt="图片名">
            </script>
            <script type="text/html" id="barDemo">
                <a class="layui-btn layui-btn-xs" lay-event="edit">修改</a>
                <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
            </script>
        </div>
    </div>


    <div class="layui-form">
        <table class="layui-table">
            <colgroup>
                <col width="150">
                <col width="150">
                <col width="150">
                <col width="200">
                <col width="150">
                <col width="150">
                <col>
            </colgroup>
            <thead>
            <tr>

                <th>联系方式</th>
                <th>名称</th>
                <th>密码</th>
                <th>Twilio服务认证字串</th>
                <th>Twilio号码</th>
                <th>Twilio服务账号</th>
                <th>编辑</th>
                <th>
                </th>
            </tr>
            </thead>
            <tbody id="l_data">

            </tbody>
        </table>
    </div>
</div>
<script src="layui/layui.js"></script>
<script>


    $(document).ready(function () {
        $.ajax({

            type: "GET",

            url: "http://svcsa.org/System",

            data: {},

            dataType: "json",

            async: false,

            headers: {
                Accept: "application/json" //设置header头
            },

            success: function (data) {

                var data = data.data;
                var s = JSON.stringify(data);
                var src = "";
                for (var i = 0; i < 1; i++) {

                    src += "<tr>";
                    src += "<td>" + data.Contact + "</td>";
                    src += "<td>" + data.POP3 + "</td>";
                    src += "<td>" + data.SMTP + "</td>";
                    src += "<td>" + data.TwilioAuth + "</td>";
                    src += "<td>" + data.TwilioNumber + "</td>";
                    src += "<td>" + data.TwilioSid + "</td>";

                    src += "<td>" + '<button   class="layui-btn layui-btn-normal layui-btn-sm edit"><i class="layui-icon"></i></button></td>';

                    src += "</tr>";
                }

                $("#l_data").html(src);
            }

        });

        function edit(id) {
            alert(id);
        }
    });

    layui.use(['table', 'form'], function () {
        var table = layui.table;
        var form = layui.form;

        $(".edit").click(function () {
            var id = $(this).attr('data')
            // alert($(this).attr('data-id'))
            layer.open({
                type: 2,
                title: '系统信息修改',
                shadeClose: true,
                shade: 0.8,
                offset: 'auto',
                scrollbar:true,
                area: ['45%', '70%'],
                content: 'system_edit.html',
                success: function (layero, index) {
                    layer.iframeAuto(index);
                },
                end: function () {
                    location.reload();
                }
            });
        })
    });
</script>